package archsw0904.controller.catalog;


public enum QueryableField {
	Isbn {
		public String toString() {
			return "isbn";
		}
		
		public String formatParam(String fielfSuffix, String val) {
			return fielfSuffix + ".isbn like '%" + val.toLowerCase() + "%'";
		}
	},
	Author {
		public String toString() {
			return "author";
		}
		
		public String formatParam(String fielfSuffix, String val) {
			return fielfSuffix + ".author like '%" + val.toLowerCase() + "%'";
		}
	},
	Title {
		public String toString() {
			return "title";
		}
		
		public String formatParam(String fielfSuffix, String val) {
			return fielfSuffix + ".title like '%" + val.toLowerCase() + "%'";
		}

	},
	Category {
		public String toString() {
			return "category";
		}
		
		public String formatParam(String fielfSuffix, String val) {
			return fielfSuffix + ".category like '%" + val.toLowerCase() + "%'";
		}
	},
	Tag {
		public String toString() {
			return "tag";
		}
		
		public String formatParam(String fielfSuffix, String val) {
			return fielfSuffix + ".tag like '%" + val.toLowerCase() + "%'";
		}

	}, 
	Price {
		public String toString() {
			return "price";
		}
		
		public String formatParam(String fielfSuffix, String val) {
			return "(" + fielfSuffix + ".price <= " + val + ")";
		}
	},
	Editor {
		public String toString() {
			return "editor";
		}
		
		public String formatParam(String fielfSuffix, String val) {
			return fielfSuffix + ".editor like '%" + val.toLowerCase() + "%'";
		}
	},
	Year {
		public String toString() {
			return "year";
		}
		
		public String formatParam(String fielfSuffix, String val) {
			return fielfSuffix + ".year like '%" + val.toLowerCase() + "%'";
		}
	},
	
	Temoraney {
		public String toString() {
			return "editor";
		}
		
		public String formatParam(String fielfSuffix, String val) {
			return fielfSuffix + ".editor like '%" + val.toLowerCase() + "%'";
		}
	};

	public abstract String formatParam(String string, String string2);
		

	public void setOrderBy(SearchOrder orderBy) {
		this.orderBy = orderBy;
	}
	public SearchOrder getOrderBy() {
		return orderBy;
	}
	private SearchOrder orderBy=SearchOrder.Default;
	
	
}
